import React from 'react';
import Toolbox from '@design/core/components/Toolbox';

function ToolboxPlugin(options = {}) {
  const { toolbox = [], ToolboxButton } = options;
  return {
    renderEditor: (props, editor, next) => {
      return (
        <Toolbox
          options={toolbox}
          ToolboxButtonComp={ToolboxButton}
          {...props}
          editor={editor}
        >
          {next(props)}
        </Toolbox>
      );
    }
  };
}

export default ToolboxPlugin;
